﻿<phone:PhoneApplicationPage
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:viewmodel="clr-namespace:Omnia.ViewModels;assembly=Omnia.ViewModels"
    xmlns:UX="clr-namespace:Omnia.UX;assembly=Omnia.UX"
    xmlns:Converters="clr-namespace:Omnia.Converters;assembly=Omnia.Converters" 
    x:Class="Omnia.Wallet.Views.FavoritePlaceView"
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="800"
    SupportedOrientations="Portrait"  Orientation="Portrait"
    shell:SystemTray.IsVisible="False">

    <phone:PhoneApplicationPage.Resources>
        <Converters:NumberGreaterThanToVisibilityConverter x:Key="NumberGreaterThanToVisibilityConverter"/>
    </phone:PhoneApplicationPage.Resources>

    <Grid x:Name="LayoutRoot">
    	<Grid.Background>
    		<ImageBrush Stretch="{Binding GlobalSettings.BackgroundImageStretch}" ImageSource="{Binding BackgroundImageSource, Mode=OneWay}"/>
    	</Grid.Background>
        <Grid.DataContext>
            <viewmodel:PlaceViewModel/>
        </Grid.DataContext>
        <controls:Panorama Title="{StaticResource IDS_APP_TITLE}">

            <controls:PanoramaItem Header="{StaticResource IDS_LABEL_PLACE_ADD}">
                <Grid>
                    <ScrollViewer>
                        <StackPanel>
                            <TextBlock Style="{StaticResource PhoneTextSubtleStyle}" Text="{StaticResource IDS_LABEL_PLACE_NAME}"/>
                            <TextBox Text="{Binding PlaceItemToAdd.Place, Mode=TwoWay}"/>
                            <Button Content="{StaticResource IDS_LABEL_PLACE_ADDTOFAV}" Command="{Binding AddPlaceCommand, Mode=OneWay}"/>

                            <toolkit:ToggleSwitch Header="{StaticResource IDS_LABEL_PLACE_AUTOSAVETOFAV}" 
                                                  Checked="ToggleSwitch_Checked" 
                                                  IsChecked="{Binding GlobalSettings.AutoSavePlace}"/>
                        </StackPanel>
                    </ScrollViewer>
                </Grid>
            </controls:PanoramaItem>

            <controls:PanoramaItem>
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition Height="auto"/>
                    </Grid.RowDefinitions>
                    <toolkit:MultiselectList ItemsSource="{Binding StorePlaceCollection}" 
                                             SelectionChanged="MultiselectList_SelectionChanged" >
                        <toolkit:MultiselectList.ItemTemplate>
                            <DataTemplate>
                                <ListBoxItem Content="{Binding Place}" />
                            </DataTemplate>
                        </toolkit:MultiselectList.ItemTemplate>
                    </toolkit:MultiselectList>

                    <UX:UXPathButton Margin="12"
                                     Grid.Row="1"
                                     Name="deletebutton"
                                     Visibility="Collapsed"
                                     IconPath="{StaticResource PATH_ICON_DELETE}"
                                     Padding="13"
                                     Command="{Binding RemovePlaceCommand}"/>
                </Grid>
            </controls:PanoramaItem>
        </controls:Panorama>
    </Grid>

</phone:PhoneApplicationPage>